<?PHP
include("../../ava-player-database/dbca/cnnxn.php");
connect();

// Variables
$totalpoints=0;
$seasonevents=0;
$totalevents=0;
$respectiveseason='';
$tablevar='';

//Teams
$SQLte='SELECT * FROM Teams WHERE PlayerID='.$_GET['player'].';';
$sendte=mysqli_query($db,$SQLte) or die(mysqli_error($db));
while ($RSte=mysqli_fetch_object($sendte)) {
	//Results
	//print '<br /><br />'.$RSte->TeamID."<br />";
	
	$SQLre='SELECT * FROM Results WHERE TeamID='.$RSte->TeamID.';';
	$sendre=mysqli_query($db,$SQLre) or die(mysqli_error($db));
	$RSre=mysqli_fetch_object($sendre);
	print $RSre->id;
	//Event
	if ($RSre->EventID!='' || $RSre->EventID!=NULL) {
		$SQLev='SELECT * FROM Events WHERE EventID='.$RSre->EventID.';';
		$sendev=mysqli_query($db,$SQLev) or die(mysqli_error($db));
		$RSev=mysqli_fetch_object($sendev);
		//Gender
		$SQLge='SELECT * FROM Gender WHERE GenderID='.$RSev->GenderID.';';
		$sendge=mysqli_query($db,$SQLge) or die(mysqli_error($db));
		$RSge=mysqli_fetch_object($sendge);
		//Division
		$SQLdi='SELECT * FROM Divisions WHERE DivisionID='.$RSev->DivisionID.';';
		$senddi=mysqli_query($db,$SQLdi) or die(mysqli_error($db));
		$RSdi=mysqli_fetch_object($senddi);
		//Partner
		$partnerlist='';
		$SQLtep='SELECT * FROM Teams WHERE TeamID='.$RSte->TeamID.';';
		$sendtep=mysqli_query($db,$SQLtep) or die(mysqli_error($db));
		//print mysqli_num_rows($sendtep);
		while ($RStep=mysqli_fetch_object($sendtep)) {
			if ($RStep->PlayerID!=$_GET['player']) {
				$SQLpa='SELECT * FROM Players WHERE PlayerID='.$RStep->PlayerID.';';
				$sendpa=mysqli_query($db,$SQLpa) or die(mysqli_error($db));
				$RSpa=mysqli_fetch_object($sendpa);
				$partnerlist=$partnerlist.'<a href="playerDetail2.php?player='.$RSpa->PlayerID.'">'.$RSpa->FirstName.' '.$RSpa->LastName.'</a>, ';
			}
		}
		
		$eventyear=date("Y",strtotime($RSev->StartDate));
		$respectiveseasonstr=strtotime(date("Y") . " -1 year");
		$respectiveseason=date('Y', $respectiveseasonstr);
		if ($eventyear==$respectiveseason) {
			$ratingswitch="";
			switch ($RSpl->CurrentUnadjustedRating) {
				case 1 : $ratingswitch="AAA"; break;
				case 2 : $ratingswitch="AA"; break;
				case 3 : $ratingswitch="A"; break;
			}
			$tablevar=$tablevar.'<tr ><td><a href="results2.php?event='.$RSre->EventID.'">'.date("M d",strtotime($RSev->StartDate)).' ('.$RSge->Gender.'\'s '.$RSdi->Division.')</a></td><td>'.substr_replace($partnerlist,"",-2).'</td><td>'.$RSre->Result.'</td><td>'.$ratingswitch.'</td><td class=last>'.$RSpl->CurrentPoints.'</td></tr>';
			$seasonevents++;
		}
		$totalevents++;
	}
}

//Players
$SQLpl='SELECT * FROM Players WHERE PlayerID='.$_GET['player'].';';
$sendpl=mysqli_query($db,$SQLpl) or die(mysqli_error($db));
$RSpl=mysqli_fetch_object($sendpl);



?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>AVA (Alki Volleyball Assoc.) - Leading promoters of Beach Volleyball in Seattle.</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="description" content="Seattle beach volleyball at Alki beach in west seattle, Division include, open, AA, A, novice, co-ed 4's, tournaments played on saturdays & sundays, prize money for open is $3000 to $5000 per event, Live DJ on the beach, EVP Pro event in 2007, sand, ocean, mountains and lots of sunshine during the summer months, register online, men's and women's beach volleyball doubles, free youth and novice clinics held on sundays by UW assistant coach and local pro players." />
<meta name="keywords" content="Beach volleyball, beach, volleyball, sand, ocean, all divisions, open, AA, A, novice, co-ed 4's, beach doubles, sand doubles, men's, women's, DJ, prize money, pro, EVP, AVA, AVP next, AVP, UW, volleyball net, net, nets, court, Alki, Seattle, Washington, Northwest, competative, fun, sun, sunshine, music, party, athletes, athlete, professional, bikini, boardshorts, umbrella, towel, views, event, competition" />
<link rel="stylesheet" type="text/css" href="css/players-table.css" media="all" />
</head>
<script type="text/javascript"> 
function showPopup(url) { 
newwindow=window.open(url,'name','height=520,width=520,top=200,left=300,scrollbars=yes,resizable=yes,toolbar=no,status=no,menubar=no,urlbar=no'); 
if (window.focus) {newwindow.focus()} 
} 
</script>
<body background="http://www.alkivolleyballassociation.com/imgs/background.gif" onload=window.refresh bgcolor="#e3e3e3" link="#54708C" vlink="#54708C" alink="#996600" leftmargin="0" topmargin="0">
<div id="players_table_container">
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
                  <tr>
                    <td width="593" valign="top"><h1 class="playerNameDetail"> Danny Meade 
                      </h1>
                      <h3></h3>
                      <div id="playerPic"> <!--<img width="200" height="200" src="" />-->
                        <div style="background:url(images/players/default.gif); width:200px; height:200px;"><img style="position:relative;left:130px;top:130px;" width="70" height="70" src="images/player-aaa.png" /></div>                        <p class="photoCredit"> </p>
                        </div>
                      <div id="playerSummary" >
                        <div class="row"><span class="label">Hometown:</span><span class="data"></span></div>
                        <div class="row"><span class="label">Resides:</span><span class="data"></span></div>
                        <div class="row"><span class="label">Height:</span><span class="data"></span></div>
                        <div class="row"><span class="label">Local Beach:</span><span class="data">Alki Beach, WA</span></div>
                        <div class="row"><span class="label">College:</span><span class="data"></span></div>
                        <table id="annualTable" cellpadding="0" cellspacing="0">
                          <tr>
                            <th>Stats:</th>
                            <th> Current Season</th>
                            <th>All Time<div id="help"><a href=ratingsChart.php onClick='showPopup(this.href);return(false);'><img src="images/help.gif" width="16" height="16" alt="AVA Ratings &amp; Points explained" /></a></div></th>
                            </tr>
                          <tr id="PlayedRow">
                            <td align="left">Played:</td>
                            <td id="PlayedData"><?PHP print $seasonevents; ?> - 6</td>
                            <td id="PlayedData"><?PHP print $totalevents; ?> - 18</td>
                            </tr>
                          <tr id="PointsRow">
                            <td align="left">Points:</td>
                            <td id="PointsData">172</td>
                            <td id="PointsData">517</td>
                            </tr>
                          <tr id="RatingRow">
                            <td align="left">Rating:</td>
                            <td id="RatingData">AA</td>
                            <td id="RatingData">AAA</td>
                            </tr>
                          <tr id="FinishRow">
                            <td align="left">Best Finish:</td>
                            <td id="FinishData">1st</td>
                            <td id="FinishData">1st (3 times)</td>
                            </tr>
                          </table>
                        </div>
                      <div class="grid">
                        <!--                    <table cellspacing="0">
                            <col  />
                            <col  />
                            <col  />
                            <col  />
                            <thead>
                              <tr class="headings">
                                <th>Event</th>
                                <th>Partner</th>
                                <th>Finish</th>
                                <th>Earned</th>
                                <th class="last">Points</th>
                              </tr>
                            </thead>
                            <tbody>-->
                        <table cellspacing=0><col  /><col  /><col  /><col  /><thead><tr class=headings><th class=year><?PHP print $respectiveseason; ?></th><th>Partner</th><th>Finish</th><th>Earned</th><th class=last>Points</th></tr></thead>
                        <tbody>
                        <?PHP print $tablevar; ?>
                        <tr ><td><a href=results2.php?event=185>August 06 (Men's Open)</a></td><td><a href=playerDetail2.php?player=94>Scott Behrbaum</a></td><td>5th</td><td>AA</td><td class=last>43</td></tr>
                        <tr ><td><a href=results2.php?event=152>May 21 (Men's Open)</a></td><td><a href=playerDetail2.php?player=152>Bryan Frost</a></td><td>2nd</td><td>AA</td><td class=last>20</td></tr><tr ><td><a href=results2.php?event=158>June 18 (Men's Open)</a></td><td><a href=playerDetail2.php?player=152>Bryan Frost</a></td><td>5th</td><td>A</td><td class=last>13</td></tr><tr ><td><a href=results2.php?event=174>July 02 (Men's Open)</a></td><td><a href=playerDetail2.php?player=152>Bryan Frost</a></td><td>3rd</td><td>AA</td><td class=last>35</td></tr><tr ><td><a href=results2.php?event=180>July 30 (Men's Open)</a></td><td><a href=playerDetail2.php?player=152>Bryan Frost</a></td><td>5th</td><td>A</td><td class=last>23</td></tr>
                        </tbody>
                        </table>
                        </div>
                      
                    </td>
                  </tr>
                </table>
<script type="text/javascript" src="http://s36.sitemeter.com/js/counter.js?site=s36alkibeach">
</script>
</div>
</body>
</html>

